<script>
    //按钮上的url处理
    function returnUrl(resData,data,event){
        var url = '', title = '',alt='';
        for(var i=0 ;i<resData.right_buttons.length; i++){
            if(resData.right_buttons[i].event == event){
                url = '',title='',alt='';
                title = resData.right_buttons[i]['params']['title'];
                alt = resData.right_buttons[i]['params']['alt'];
                //新增如果json设置了值 则优先使用值替换分页数据中的值
                if(resData.right_buttons[i]['params']['url_param_field_value'] != '' && resData.right_buttons[i]['params']['url_param_field_value'] !=undefined){
                    data[resData.right_buttons[i]['params']['url_param_field']] = resData.right_buttons[i]['params']['url_param_field_value'];
                }

                if(resData.right_buttons[i]['params']['url_param_extra_field_value'] != '' && resData.right_buttons[i]['params']['url_param_extra_field_value'] !=undefined){
                    data[resData.right_buttons[i]['params']['url_param_extra_field']] = resData.right_buttons[i]['params']['url_param_extra_field_value'];
                }

                if(resData.right_buttons[i]['params']['is_hash']){
                    //如果是hash 将以当前的链接作为基础链接 
                    url += window.location.pathname;
                    if(resData.right_buttons[i]['params']['url_param_field'] != '' && data[resData.right_buttons[i]['params']['url_param_field']] != undefined){
                        url += "?" + resData.right_buttons[i]['params']['url_param_field']+"="+data[resData.right_buttons[i]['params']['url_param_field']];
                    }
                    if(resData.right_buttons[i]['params']['url_param_extra_field'] != '' && data[resData.right_buttons[i]['params']['url_param_extra_field']] != undefined){
                        if(url.indexOf('?')>0){
                            url += "&"+resData.right_buttons[i]['params']['url_param_extra_field']+"="+data[resData.right_buttons[i]['params']['url_param_extra_field']];
                        }else{
                            url += "?"+resData.right_buttons[i]['params']['url_param_extra_field']+"="+data[resData.right_buttons[i]['params']['url_param_extra_field']];
                        }
                    }
                    url += (resData.right_buttons[i]['params']['url'].substr(0, 1) == "#" ? resData.right_buttons[i]['params']['url'] : "#"+resData.right_buttons[i]['params']['url']);
                    
                }else{
                    url += resData.right_buttons[i]['params']['url'];
                    if(resData.right_buttons[i]['params']['url_param_field'] != '' && data[resData.right_buttons[i]['params']['url_param_field']] != undefined){
                        url += "?"+resData.right_buttons[i]['params']['url_param_field']+"="+data[resData.right_buttons[i]['params']['url_param_field']];
                    }
                    if(resData.right_buttons[i]['params']['url_param_extra_field'] != '' && data[resData.right_buttons[i]['params']['url_param_extra_field']] != undefined){
                        if(url.indexOf('?')>0){
                            url += "&"+resData.right_buttons[i]['params']['url_param_extra_field']+"="+data[resData.right_buttons[i]['params']['url_param_extra_field']];
                        }else{
                            url += "?"+resData.right_buttons[i]['params']['url_param_extra_field']+"="+data[resData.right_buttons[i]['params']['url_param_extra_field']];
                        }
                    }

                }
            }
        }
        if(event == 'qrcode' || event == 'image'){
            return {
                url:url,
                title:title,
                alt:alt
            };
        }
        return url;
    }
</script>
